package com.inspinia.upms.common.model.resource;

import com.inspinia.base.common.model.NameCodeEnum;

/**
 * Created by Veblen on 2017/1/1.
 */
public enum UpmsResourcesType implements NameCodeEnum {

    menu(1, "菜单"), resources(2, "资源");

    private final int code;
    private final String name;

    UpmsResourcesType(int code, String name) {
        this.code = code;
        this.name = name;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getName() {
        return name;
    }

    public static UpmsResourcesType valueOf(int code) {
        for (UpmsResourcesType type : UpmsResourcesType.values()) {
            if (type.code == code) {
                return type;
            }
        }
        return null;
    }
    public static UpmsResourcesType valueOfString(String code) {
        for (UpmsResourcesType type : UpmsResourcesType.values()) {
            if (type.name.equals(code)) {
                return type;
            }
        }
        return null;
    }
}
